package com.vv.service.Impl;

import com.vv.bean.Product;
import com.vv.dao.ProductMapper;
import com.vv.service.ProductService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ProductServiceImpl implements ProductService {

    @Resource
    ProductMapper mapper;

    @Override
    public int addProduct(Product product) {
        System.out.println(mapper);
        return mapper.insert(product);
    }

    @Override
    public List<Product> getProducts() {
        return mapper.getList();
    }

    @Override
    public Product getProductByPid(Long pid) {
        return mapper.selectByPrimaryPid(pid);
    }
}
